package thread;

/**
 * @author Dianzhi Han
 * @version 1.0
 * @description: TODO
 * @date 2022/10/27 22:59
 */
public class OtherMethod {
    public static void main(String[] args) {
//        // 匿名内部类继承Thread类
//        Thread t1 = new Thread() {
//            @Override
//            public void run() {
//                System.out.println("匿名内部类继承Thread类");
//                System.out.println(Thread.currentThread().getName());
//            }
//        };
//        t1.start();
//        Thread thread = new Thread(new Runnable() {
//            @Override
//            public void run() {
//                System.out.println("匿名内部类实现Runnable接口");
//                System.out.println(Thread.currentThread().getName());
//            }
//        });
//        thread.start();
        Thread t1 = new Thread(() -> System.out.println("Lambda表达式实现Runnable接口"));
        t1.start();
        System.out.println("这是主线程" + Thread.currentThread().getName());
    }
}